Page({
  data: {
    currentUser:{}
  },
  toTomatoData:function(){
    wx.navigateTo({
      url: '/pages/tomato/tomatoRecord/tomatoRecord',
    })
  },
  toMyClockin:function(){
    wx.navigateTo({
      url: '/pages/user/clockinStatistics/clockinStatistics',
    })
  },
  logout:function(){
    wx.removeStorage({
      key: 'userinfo',
      success: function(res){
        wx.hideTabBar()
        wx.showToast({
          title: '退出登录',
          icon: 'success',
          duration: 1000
        })
        wx.reLaunch({
          url: '/pages/habit/habitIndex/habitIndex'
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let _this = this
    if(wx.getStorageSync('userinfo')){
      _this.setData({
        currentUser : wx.getStorageSync('userinfo')
      })
    }
  }
})